#include "StdAfx.h"
#include "Basic.h"
#include <math.h>
#include <iostream>
using namespace std;

#define SUCCESS 0
int appstauscode;
Basic::Basic(void)
{
}


Basic::~Basic(void)
{
}

typedef int statuscode;

statuscode returnstatuscode()
{

	return 0;
}

void updateappstatuscode()
{
	appstauscode = SUCCESS;
}
class DevidedByZero{
public:
	DevidedByZero()
	{
	}
	DevidedByZero(const char* p)
	{
		
	}
	const char* getdescription(){
		return desp;
	}
private: 
	char *desp;
};
class OverFlow{};
class UnderFlow{};
double Devide(double a, double b)
{
	if(abs(b) <= std::numeric_limits<double>::epsilon())
	{
		throw new DevidedByZero();
		throw DevidedByZero();
		//why not new a class as csharps
	}

	double result = a /b;
	return result;
}

void Test(int index)
{
	double a = 100;
	double b = 10;
	int x[20] = {0};
	try
	{
		 double result = Devide(a, b);
		 if(index > 20) throw OverFlow();
		 if(index < 0) throw UnderFlow();
	}
	catch(DevidedByZero& e){

		cerr<<"dvide by zero"<<endl;
	}
	catch(OverFlow&){

	}

	catch(UnderFlow&){

	}
	catch(...)
	{

	}
}

